<template>
	<view class="container">
		<!-- #ifdef APP-PLUS -->
		<view class="header">
			<view>我的</view>
		</view>
		<!-- #endif -->
		<!-- #ifndef MP-WEIXIN  -->
		<!-- #ifdef APP-PLUS -->
		<view style="background: linear-gradient(90deg, #FFEDE2 0%, #FFE0E3 100%);position: relative;top:100upx;">
			<!-- #endif -->
			<!-- #ifndef APP-PLUS -->
			<view style="background: linear-gradient(90deg, #FFEDE2 0%, #FFE0E3 100%);position: relative;top:0upx;">
				<!-- #endif -->
				<view class="" style="width: 100%;height: 50upx;display: block;position: relative;"></view>
				<!-- h5显示 -->
				<view class="user-info-box">
					<view style="display: flex;flex-direction: row;justify-content: space-between;">
						<view style="width: 16%;margin-left: 14upx;" class="portrait-box" @click="goLogin">
							<image v-if="image_url" class="portrait" :src="image_url"></image>
							<image v-else class="portrait" src="/static/logo2.png"></image>
						</view>
						<view style="text-align: left;margin-left: 12upx;width: 70%;">
							<view class="info-box" @click="goUpdataNickName" style="margin-top: 20rpx">
								<text class="username">{{ mobile ? mobile : '游客' }}</text>
							</view>
							<view style="display: flex;">
								<view @click="copyHref" v-if="relation_id&&isEnable != '否'"
									style="margin-top: 12upx;font-size: 24upx;color: #333333;padding: 4upx 20upx;border: 3rpx solid #666666;border-radius: 20rpx;">
									邀请ID：{{ relation_id }}
								</view>
							</view>
						</view>
						<image class="img-xin" src="../../static/icon_ld.png"
							@click="navToLogin('/pages/member/message')">
						</image>
					</view>
				</view>
				<!-- #endif -->


				<!-- #ifdef MP-WEIXIN -->
				<view style="background: linear-gradient(90deg, #FFEDE2 0%, #FFE0E3 100%);position: relative;">
					<!-- 小程序显示 -->
					<view class="user-info-box">
						<view
							style="display: flex;flex-direction: row;justify-content: space-between;padding-top: 80rpx;">
							<button open-type="chooseAvatar" @chooseavatar="onChooseAvatar" v-if="isLogin"
								style="background: none;padding: 0rpx;width: 20%;">
								<view style="margin-left: 14upx;display: flex;justify-content: center;"
									class="portrait-box">
									<image v-if="image_url" class="portrait" :src="image_url"></image>
									<image v-else class="portrait" src="/static/logo2.png"></image>
									<!-- <image v-if="image_url" class="portrait" :src="image_url"></image>
								<image v-else class="portrait" src="/static/logo2.png"></image> -->
								</view>
							</button>
							<view style="width: 16%;margin-left: 14upx;" class="portrait-box" @click="goLogin" v-else>
								<image v-if="image_url" class="portrait" :src="image_url"></image>
								<image v-else class="portrait" src="/static/logo2.png"></image>
							</view>
							<view style="text-align: left;margin-left: 12upx;width: 78%;">
								<view style="margin-left: 15rpx;" v-if="isLogin">
									<view class="info-box" @click="goUpdataNickName" style="margin-top: 16rpx">
										<text class="username">{{ mobile ? mobile : '游客' }}</text>
									</view>
									<view style="display: flex;">
										<view @click="copyHref" v-if="relation_id&&isEnable != '否'"
											style="margin-top: 12upx;font-size: 24upx;color: #333333;padding: 4upx 20upx;border: 3rpx solid #666666;border-radius: 20rpx;">
											邀请ID：{{ relation_id }}
										</view>
									</view>
								</view>
								<view v-else class="text-xl text-bold margin-top-lg margin-left" @click="goLogin">登录
								</view>
							</view>
						</view>
					</view>
					<!-- #endif -->
				</view>

				<view class="bgImg" style="width: 100%;position: relative;">
					<view style="display: flex;justify-content: space-around;font-size: 28upx;color: #FFFFFF; ">
						<view class="addTo" @click="getMoneys()" style="width: 25%;text-align: center;"
							v-if="isEnable != '否'">
							<text style="font-weight: bold;"> <text style="font-size: 20upx;">￥</text>{{moneys}}</text>
							<text class="user-wen">可提现</text>
						</view>
						<view class="addTo" @click="navToLogins('/pages/zysc/my/yaoqing')"
							style="width: 25%;text-align: center;" v-if="isEnable != '否'">
							<text style="font-weight: bold;"> <text style="font-size: 20upx;">￥</text>{{tuanSum}}</text>
							<text class="user-wen">团队收益</text>
						</view>
						<view class="addTo" @click="navToLogin('/pages/member/jifen')"
							style="width: 25%;text-align: center;">
							<text style="font-weight: bold;"> <text style="font-size: 20upx;"></text>{{jifen}}</text>
							<text class="user-wen">我的积分</text>
						</view>
						<view class="addTo" @click="navToLogin('/pages/member/youhuijuan')"
							style="width: 25%;text-align: center;">
							<text style="font-weight: bold;">{{JuanCount}}</text>
							<text class="user-wen">优惠券</text>
						</view>
					</view>
				</view>


				<!--开通会员 -->
				<view class="vip-card-box" v-if="isEnable != '否'">
					<view class="tit" v-if="!relation_id">
						<view class="yticon">
							开通会员
						</view>
						<view>会员购买商品享省钱+返现</view>
					</view>
					<view class="tit" v-else>
						<view class="vipFont">
							<image
								src="https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/fb61028921bf1c037a0af3d56b4e2785.png">
							</image>
						</view>
						<view class="yticon">
							<text>
								{{ dengji }}
							</text>
							<text class="margin-left-sm">还可邀请{{ dengjides}}</text>
						</view>
					</view>
					<view class="b-btn" @click="copyTklWenAn">
						{{des}}
					</view>
				</view>

				<view :style="isEnable != '否' ? 'background: #FFFFFF;width: 95%;  border-radius: 15upx;margin: 0rpx 20rpx 20rpx;position: relative;top: -80rpx;'
					: 'background: #FFFFFF;width: 95%;  border-radius: 15upx;margin: 0rpx 20rpx 20rpx;'">

					<view class="tui-box tui-tool-box" style="margin:0 auto;">
						<view class="tui-cell-header">
							<view class="text-lg text-bold" style="margin-top: 15upx;">我的订单</view>
							<view class="tui-tits" @click="navToLogins('/pages/zysc/my/myList?itemName=quanbu')">查看全部
								<image
									src="https://api.shengqianxiong.com.cn/file/uploadPath/2021/10/08/9a7ea5f18fae76c2f9c9d5b3e8323f4e.png" />
								</image>
							</view>
						</view>
						<view class="tui-order-list tui-flex-wrap1">
							<view class="tui-tool-item1"
								@click="navToLogins('/pages/zysc/my/myList?itemName=daifukuan')">
								<min-badge :count='dingdanCountList.count1'>
									<view class="tui-icon-box">
										<image
											src="https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/7f8b3a57b44d718517622a1ae4b745c7.png"
											class="tui-tool-icon1"></image>
									</view>
								</min-badge>
								<view class="tui-tool-text1">待付款</view>
							</view>
							<view class="tui-tool-item1"
								@click="navToLogins('/pages/zysc/my/myList?itemName=daifahuo')">
								<min-badge :count='dingdanCountList.count2'>
									<view class="tui-icon-box">
										<image
											src="https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/88968e7024194ae4e9ba048d7f8987f2.png"
											class="tui-tool-icon1"></image>
									</view>
								</min-badge>
								<view class="tui-tool-text1">待发货</view>
							</view>
							<view class="tui-tool-item1"
								@click="navToLogins('/pages/zysc/my/myList?itemName=daishouhuo')">
								<min-badge :count='dingdanCountList.count3'>
									<view class="tui-icon-box">
										<image
											src="https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/8a6c0c23da943883b2654847d663a87d.png"
											class="tui-tool-icon1"></image>
									</view>
								</min-badge>
								<view class="tui-tool-text1">待收货</view>
							</view>
							<view class="tui-tool-item1"
								@click="navToLogins('/pages/zysc/my/myList?itemName=yishouhuo')">
								<min-badge :count='dingdanCountList.count4'>
									<view class="tui-icon-box">
										<image
											src="https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/d43e26e8723c7cc6af3f0f095867f9ff.png"
											class="tui-tool-icon1"></image>
									</view>
								</min-badge>
								<view class="tui-tool-text1">待评价</view>
							</view>
							<view class="tui-tool-item1" @click="navToLogins('/pages/zysc/my/myList?itemName=tuikuan')">
								<min-badge :count='dingdanCountList.count5'>
									<view class="tui-icon-box">
										<image
											src="https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/5ae4d6a8822080efa6fc876983416627.png"
											class="tui-tool-icon1"></image>
									</view>
								</min-badge>
								<view class="tui-tool-text1">退款/售后</view>
							</view>
						</view>
					</view>
				</view>


				<view class="myteam" v-if="isEnable != '否'" :style="isEnable != '否' ? 'top: -74rpx;' : ''">
					<view class="padding-bottom-sm text-lg text-bold">返利金额</view>
					<view class="flex align-center justify-between">
						<view class="teammoney" @click="navToLogins('/pages/zysc/my/teamorder')">
							<view class="team">团队返利</view>
							<view class="team_b">￥<text>{{TuanFL}}</text></view>
						</view>
						<view class="mymoney" @click="navToLogins('/pages/zysc/my/rebateorder')">
							<view class="team">我的返利</view>
							<view class="team_b">￥<text>{{MyFL}}</text></view>
						</view>
					</view>
				</view>

				<uni-popup ref="popus" type="bottom">
					<view
						style="width: 98%;height: max-content;background: #FFFFFF;border-radius: 20upx;margin: 10rpx;">
						<view style="width: 100%;text-align: center;padding: 40upx;color: #09BB07;"
							@click="navTo('/pages/member/shopapply')">新商户入驻</view>
						<view style="height: 1rpx;background: #c1c1c1;"></view>
						<view style="width: 100%;text-align: center;padding: 40upx;"
							@click="navTo('/pages/member/checkShopApply')">商户修改</view>
					</view>
					<view
						style="width: 98%;height: max-content;background: #FFFFFF;border-radius: 20upx;margin: 10rpx;">
						<view style="width: 100%;text-align: center;padding: 40upx;color: #999999;" @click="closePopu">
							取消</view>
					</view>
				</uni-popup>

				<view :style="isEnable != '否' ? 'background: #FFFFFF;width: 95%;  border-radius: 15rpx;margin: 20rpx;position: relative;top: -68rpx;'
					:'background: #FFFFFF;width: 95%;border-radius: 15rpx;margin: 20rpx;'">

					<view class="tui-box tui-tool-box" style="margin:0 auto;padding-bottom: 40upx;">
						<view class="tui-order-list tui-flex-wrap">
							<view class="tui-tool-item" @click="getMoneys()" v-if="isEnable != '否'">
								<view class="tui-icon-box">
									<image :src="my10" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">我的钱包</view>
							</view>
							<view class="tui-tool-item" @click="navToLogin('/pages/member/collection?className=我的收藏')">
								<view class="tui-icon-box">
									<image :src="my1" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">收藏夹</view>
							</view>
							<view v-if="isEnable != '否'" class="tui-tool-item"
								@click="navToLogin('/pages/member/collection?className=我的足迹')">
								<view class="tui-icon-box">
									<image :src="my2" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">我的足迹</view>
							</view>
							<view v-if="isEnable != '否'" class="tui-tool-item"
								@click="navToLogins('/pages/member/gzdianpu')">
								<view class="tui-icon-box">
									<image :src="my3" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">关注店铺</view>
							</view>
							<view class=" tui-tool-item" @click="navToYaoqingLogins('/pages/member/yao')">
								<view class="tui-icon-box">
									<image :src="my4" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text ">邀请好友</view>
							</view>
							<view class="tui-tool-item" @click="navTo('/package/pages/chat/chat')">
								<min-badge :count='adminjiaobiaoNumber'>
									<view class="tui-icon-box">
										<image :src="my9" class="tui-tool-icon"></image>
									</view>
								</min-badge>
								<view class="tui-tool-text">联系客服</view>
							</view>
							<view class=" tui-tool-item" @click="navToLogins('/package/pages/chat/chatList')">
								<min-badge :count='jiaobiaoNumber'>
									<view class="tui-icon-box">
										<image :src="my5" class="tui-tool-icon"></image>
									</view>
								</min-badge>
								<view class="tui-tool-text">聊天列表</view>
							</view>
							<view v-if="isEnable != '否'" class="tui-tool-item"
								@click="navToLogin('/pages/member/account')">
								<view class="tui-icon-box">
									<image :src="my6" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">系统设置</view>
							</view>
							<view class="tui-tool-item" @click="navToLogin('/package/pages/goreport')">
								<view class="tui-icon-box">
									<image :src="my7" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">我的投诉</view>
							</view>
							<view class=" tui-tool-item" @click="goEditShop" v-if="shopSelect != '否'">
								<view class="tui-icon-box">
									<image :src="my8" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">商户入驻</view>
							</view>
							<view class="tui-tool-item" @click="navTo('/package/pages/index/bangzhu')">
								<view class="tui-icon-box">
									<image :src="my11" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">帮助中心</view>
							</view>
							<view class="tui-tool-item" @click="navTo('/pages/feedback')">
								<view class="tui-icon-box">
									<image :src="my12" class="tui-tool-icon"></image>
								</view>
								<view class="tui-tool-text">意见反馈</view>
							</view>
						</view>
					</view>
				</view>
			</view>
</template>
<script>
	import listCell from '../../components/mix-list-cell';
	import wmPosters from '@/components/wm-poster/wm-posters.vue';
	import minBadge from '@/components/min-badge/min-badge'
	import configdata from '../../common/config.js';
	import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
	export default {
		components: {
			uniCountdown,
			listCell,
			wmPosters,
			minBadge
		},
		data() {
			return {
				helpListLength: 0,
				itemTitle: '',
				originalPrice: '',
				attrValuecoverImg: '',
				salesNum: '',
				peopleNum: 0,
				itemdate: '',
				CheckOrder: false,

				isLogin: false,
				TuanFL: 0,
				MyFL: 0,
				modalName: '',
				couponlist: [],
				des: '会员申请',
				coverTransform: 'translateY(0px)',
				coverTransition: '0s',
				mobile: '',
				relation_id: '',
				jifen: '0',
				image_url: '/static/logo2.png',
				gender: '',
				isTuan: 0,
				JuanCount: 0,
				moneyAll: '0',
				shopSelect: '否',
				moneys: '0',
				tuanSum: '0',
				messageList: [],
				dingdanCountList: {},
				jiesuan: '0',
				grade: '',
				phone: '',
				dengji: '',
				dengjides: '',
				lastjiesuan: '0',
				gonggao: '',
				lastMoneyAll: '0',
				orderNum: '0',
				orderMonthNum: '0',
				totalMoney: '0',
				isInvitation: 0,
				moving: false,
				isEnable: '否',
				jiaobiaoNumber: 0,
				adminjiaobiaoNumber: 0,
				itemendprice: '识别二维码免费领取',
				itemtitle: '',
				totalMoney1: '0',
				itemprice: '',
				erweima: '',
				itempic: '',
				image111: 'https://api.shengqianxiong.com.cn/app-image/my111.png',
				my1: 'https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/b26ddce48fe723636b4166942ff86e89.png',
				my2: 'https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/18fb93514576162c037d7fe7f32c330a.png',
				my3: 'https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/f5f7381ffda0d4a13d12095fe31d0d72.png',
				my4: 'https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/1b90cb8e3b38cef4ecbab568abac1160.png',
				my5: 'https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/8f52f9b956eb297935a9bf9482c2c31a.png',
				my6: 'https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/0f48fa8d69aebf94ce926f659f80a0e4.png',
				my7: 'https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/6097717b38b9d98c6078bd857652035b.png',
				my8: 'https://shop.shengqianxiong.com.cn/img/20211011/35c56a718ca549f897b91493a2722b66.png',

				my9: 'https://shop.shengqianxiong.com.cn/file/uploadPath/2022/11/25/c18d30e439b49032872afdce03328277.jpg', //联系客服
				my10: 'https://shop.shengqianxiong.com.cn/file/uploadPath/2022/11/25/7b95996a84affbd37d556a220d0e551c.jpg', //我的钱包
				my11: 'https://shop.shengqianxiong.com.cn/file/uploadPath/2022/11/25/6740eea863b4abb5e62ad272bc0b3481.jpg', //帮助中心
				my12: 'https://shop.shengqianxiong.com.cn/file/uploadPath/2022/11/25/f148b63e49cf5fdfe1ae4cda54f0e2bd.jpg', //意见反馈
				footprintKey: 'orange-sqx-footprint',
				guanyu: ''
			};
		},

		onLoad() {
			this.shopSelect = this.$queue.getData('shopSelect');
			let a = this.$queue.getData("isEnable")
			if (a) {
				this.isEnable = a;
			}

			let userId = this.$queue.getData('userId');
			if (userId) {
				this.getUserInfo(userId);
			}
			//#ifdef H5
			if (window.location.href.indexOf('?invitation=') !== -1 || window.location.href.indexOf('&invitation=') !== -
				1) {
				if (window.location.href.indexOf('?invitation=') !== -1) {
					this.$queue.setData('relation', window.location.href.split('?invitation=')[1].split('&')[0]);
				} else {
					this.invitation = window.location.href.split('&invitation=')[1].split('&')[0];
					this.$queue.setData('relation', window.location.href.split('&invitation=')[1].split('&')[0]);
				}
			}
			//#endif
			setInterval(d => {
				this.adminjiaobiaoNumber = this.$queue.getData('adminkefuNumber') ? this.$queue.getData(
					'adminkefuNumber') : 0;
				this.jiaobiaoNumber = this.$queue.getData('kefuNumber') ? this.$queue.getData('kefuNumber') : 0;
			}, 2000);
		},
		onShow() {
			this.guanyu = this.$queue.getData('GYWN');
			let a = this.$queue.getData("isEnable")
			if (a) {
				this.isEnable = a;
			}
			let token = this.$queue.getData('token');
			if (token) {
				this.isLogin = true;
			} else {
				this.isLogin = false;
			}

			this.gonggao = this.$queue.getData('myGongGao');
			let mobile = this.$queue.getData('nickName');
			this.phone = this.$queue.getData('mobile');
			let image_url = this.$queue.getData('image_url');
			let gender = this.$queue.getData('gender');

			if (mobile && mobile !== 'undefined') {
				this.mobile = mobile;
			} else {
				this.mobile = '游客';
			}
			if (image_url && image_url !== 'undefined') {
				this.image_url = image_url;
			} else {
				this.image_url = '/static/logo2.png';
			}
			if (gender) {
				this.gender = gender;
			}
			let relation_id = this.$queue.getData('relation_id');
			if (relation_id && relation_id !== 'undefined') {
				this.des = '我的特权';
				this.relation_id = relation_id;
			} else {
				this.des = '会员申请';
				this.relation_id = '';
			}
			let userId = this.$queue.getData('userId');
			if (userId) {
				this.getDingDanCount();
				//this.getMoney();
				this.getUserInfo(userId);
				this.couponlist = this.$queue.get(this.footprintKey);
				this.$Request.getT('/cash/money/' + userId).then(res => {
					if (res.status === 0 && res.data) {
						this.moneys = parseFloat(res.data).toFixed(2);
					} else {
						this.moneys = '0';
					}
				});
				this.$Request.getT('/ordersRelation/tuanSum?userId=' + userId).then(res => {
					if (res.status === 0 && res.data) {
						this.tuanSum = parseFloat(res.data.data).toFixed(2);
					} else {
						this.tuanSum = '0.00';
					}
				});

				this.$Request.getT('/ordersRelation/tuanStatistaical?userId=' + userId).then(res => {
					if (res.status === 0) {
						if (res.data.sum2) {
							this.TuanFL = res.data.sum2;
						} else {
							this.TuanFL = 0;
						}
					}
				});

				this.$Request.getT('/ordersRelation/statistaical?userId=' + userId).then(res => {
					if (res.status === 0) {
						if (res.data.sum2) {
							this.MyFL = res.data.sum2;
						} else {
							this.MyFL = 0;
						}
					}
				});
			} else {
				this.dingdanCountList = {};
				this.CheckOrder = false;
				this.TuanFL = 0;
				this.MyFL = 0;
				this.isTuan = 0;
				this.totalMoney = '0';
				this.orderNum = '0';
				this.moneys = '0';
				this.tuanSum = '0';
				this.moneyAll = '0';
				this.lastjiesuan = '0';
				this.lastMoneyAll = '0';
				this.orderMonthNum = '0';
				this.jiesuan = '0';
				this.jifen = '0';
			}
			this.getYouHuiJuanCount();
		},
		methods: {
			//微信填写能力获取头像
			onChooseAvatar(e) {
				console.log(e.detail.avatarUrl)
				let that = this;
				let token = uni.getStorageSync('token');
				uni.showLoading({
					title: '上传中...'
				});
				let userId = uni.getStorageSync('userId');
				uni.uploadFile({
					url: that.config("APIHOST1") + '/alioss/upload', //真实的接口地址
					filePath: e.detail.avatarUrl,
					header: {
						token: token
					},
					name: 'file',
					success: uploadFileRes => {
						let url = JSON.parse(uploadFileRes.data).data;
						that.$Request.postJson(
							'/user/updateImgUrl?userId=' +
							userId + '&imgUrl=' + url).then(
							res => {
								uni.hideLoading();
								if (res.status === 0) {
									that.$queue.showToast(
										"更新成功");
									that.getUserInfo(userId);
								}
							});
					}
				});
			},
			about(url) {
				uni.showModal({
					showCancel: false,
					title: '关于我们',
					content: this.guanyu,
					success: e => {
						if (e.confirm) {}
					}
				});
			},
			getCommondityList(id) {
				this.$Request.getT('/goods/find?id=' + id).then(res => {
					if (res.status === 0) {
						this.attrValuecoverImg = res.data.coverImg;
					}
				});
			},
			getGoodsDetails(helpGoodsId) {
				this.$Request.getT('/helpGoods/selectHelpGoodsDetails?helpGoodsId=' + helpGoodsId).then(res => {
					if (res.status == 0) {
						this.salesNum = res.data.salesNum ? res.data.salesNum : 0;
						this.peopleNum = res.data.peopleNum ? res.data.peopleNum : 0;
					}
				});
			},
			closePopu() {
				this.$refs.popus.close();
			},
			goEditShop() {
				let token = this.$queue.getData('token');
				if (token) {
					this.$refs.popus.open();
				} else {
					this.goLoginInfo();
				}
			},
			getDingDanCount() {
				let userId = this.$queue.getData('userId');
				let count = 0;
				this.$Request.getT('/orders/count?userId=' + userId).then(res => {
					if (res.status === 0) {
						count = res.data.count1 + res.data.count2 + res.data.count3 + res.data.count4 + res.data
							.count5;
						this.dingdanCountList = res.data;
					}
				});

			},
			getYouHuiJuanCount() {
				let userId = this.$queue.getData('userId');
				this.$Request.getT('/selfCouponUser/userList?page=0&size=100&userId=' + userId + '&goodsId=&type=0').then(
					res => {
						if (res.status === 0) {
							this.JuanCount = res.data.totalElements;
						}
					});
			},
			//升级规则弹框
			shengJiMethod() {
				uni.navigateTo({
					url: '/pages/member/yao'
				});
			},
			//邀请码复制
			copyHref() {
				uni.setClipboardData({
					data: this.relation_id,
					success: r => {
						this.$queue.showToast('邀请码复制成功');
					}
				});
			},
			//获取用户信息
			getUserInfo(userId) {
				this.$Request.getT('/user/' + userId).then(res => {
					if (res.status === 0) {
						if (res.data.orderJifen) {
							this.jifen = parseFloat(res.data.orderJifen).toFixed(0);
						}
						this.$queue.setData('invitationCode', res.data.invitationCode);
						this.$queue.setData('image_url', res.data.image_url);
						this.$queue.setData('relation_id', res.data.relationId);
						this.$queue.setData('nickName', res.data.nickName);
						this.$queue.setData('isInvitation', res.data.isInvitation);
						if (res.data.isTuan) {
							this.isTuan = parseInt(res.data.isTuan);
						}
						if (res.data.gradeDes) {
							this.dengji = res.data.gradeDes;
						} else {
							this.dengji = '已邀请0人';
						}
						if (res.data.gradeNumber) {
							if (res.data.gradeNumber == '还可邀请0人') {
								this.dengjides = '已到达最高等级';
							} else {
								this.dengjides = res.data.gradeNumber;
							}
						} else {
							let number = this.$queue.invitaionNum();
							this.dengjides = '还可邀请' + number + '人';
						}
						this.grade = res.data.grade;
						this.isInvitation = res.data.isInvitation;
						this.$queue.setData('relation', res.data.invitation);
						this.$queue.setData('gender', parseInt(res.data.gender));
						this.gender = parseInt(res.data.gender);
						if (res.data.image_url) {
							this.image_url = res.data.image_url;
						} else {
							this.image_url = '/static/logo2.png';
						}
						if (res.data.relationId) {
							this.relation_id = res.data.relationId;
							this.des = '我的特权';
						} else {
							this.relation_id = '';
							this.des = '会员申请';
						}
						if (res.data.nickName) {
							this.mobile = res.data.nickName;
						} else {
							this.mobile = res.data.phone;
						}
					} else {
						this.$queue.logout();
						uni.showModal({
							title: '用户信息提示',
							content: '本地用户信息失效需要重新授权登录',
							showCancel: false,
							success: e => {
								uni.navigateTo({
									url: '/pages/member/register'
								});
							}
						});
					}
				});
			},

			//会员申请弹框
			copyTklWenAn: function() {
				let relation_id = this.$queue.getData('relation_id');
				let token = this.$queue.getData('token');
				let userId = this.$queue.getData('userId');
				let gradle = this.$queue.getData('gradle');
				if (!token) {
					this.goLoginInfo();
				} else {
					if (!relation_id) {
						uni.navigateTo({
							url: '/pages/public/mobile'
						});
					} else {
						uni.showModal({
							cancelText: '关闭',
							confirmColor: '#e10a07',
							cancelColor: '#999999',
							confirmText: '我要升级',
							showCancel: true,
							title: '我的特权',
							content: '1、享受 ' +
								this.dengji +
								'级返现！\n2、购买商品可享受省钱 +返现！\n3、分享商品给好友购买拿返现金额！\n4、邀好友加入享受永久粉丝提成！\n5、可生成专属商城推广链接;\n6、更多会员特权我们将陆续上线！\n注：VIP越高返现越高哦',
							success: res => {
								if (res.confirm) {
									this.shengJiMethod();
								}
							}
						});
					}
				}
			},
			//获取付款收入查询
			getMoney() {
				let that = this;
				let token = this.$queue.getData('token');
				let relation_id = this.$queue.getData('relation_id');
				if (token && relation_id && relation_id !== 'undefined') {
					//团队本月付款收入
					var date = new Date();
					var year = date.getFullYear();
					var month = date.getMonth() + 1;
					var day = date.getDate();
					if (month < 10) {
						month = '0' + month;
					}
					if (day < 10) {
						day = '0' + day;
					}
					var month1 = date.getMonth();
					var nowDate = year + '-' + month;
					if (month1 < 10) {
						month1 = '0' + month1;
					}
					var lastDate = year + '-' + month1;
					this.$Request.getT('/statistics/TeamOrderTotalByRelation?relation=' + relation_id +
						'&tk_status=12&time=' +
						nowDate).then(res => {
						if (res.status === 0) {
							let totalMoney = 0;
							if (res.data) {
								totalMoney = parseFloat(res.data).toFixed(2);
							}
							this.$Request.getT('/statistics/TeamOrderTotalByRelation?relation=' + relation_id +
								'&tk_status=3&time=' +
								nowDate).then(res => {
								if (res.status === 0 && res.data) {
									this.totalMoney = (parseFloat(res.data) + parseFloat(totalMoney))
										.toFixed(2);
								} else {
									this.totalMoney = totalMoney;
								}

								uni.hideLoading();
							});
						} else {
							this.totalMoney = '0';
						}

						uni.hideLoading();
					});
				} else {
					that.totalMoney = '0';
					that.orderNum = '0';
					that.moneys = '0';
					that.moneyAll = '0';
					that.lastjiesuan = '0';
					that.lastMoneyAll = '0';
					that.orderMonthNum = '0';
					that.jiesuan = '0';
				}
			},
			//立即提现
			getMoneys() {
				let token = this.$queue.getData('token');
				if (token) {
					this.navTo('/pages/member/cash');
				} else {
					this.goLoginInfo();
				}
			},
			//结算弹框
			showMessage() {
				uni.showModal({
					showCancel: false,
					title: '结算提示',
					confirmColor: '#e10a07',
					content: '每个月25号结算上月【确认收货】的订单，结算完成后【可提现金额】才会同步更新金额。因结算订单量大，结算时间会较长，结算会在25号晚上完成，建议您26号进行提现。\n举例：5月份确认收货订单，6月25号才会进行结算，以此类推'
				});
			},
			/**
			 * 统一跳转接口,拦截未登录路由
			 * navigator标签现在默认没有转场动画，所以用view
			 */
			navTo(url) {
				this.$refs.popus.close();
				if (url === '/pages/member/help') {
					//#ifdef H5
					window.location.href = this.$queue.publicYuMing() + '/help/custom.html';
					//#endif
					//#ifdef APP-PLUS
					uni.navigateTo({
						url: '/pages/member/webview?url=' + this.$queue.publicYuMing() + '/help/custom.html'
					});
					//#endif
				} else {
					uni.navigateTo({
						url
					});
				}
			},
			/**
			 * 统一跳转接口,拦截未登录路由
			 * navigator标签现在默认没有转场动画，所以用view
			 */
			navToLogin(url) {
				let token = this.$queue.getData('token');
				let mobile = this.$queue.getData('mobile');
				let userId = this.$queue.getData('userId');
				if (token) {
					this.$Request.getT('/user/' + userId).then(res => {
						if (res.status === 0 && res.data.phone) {
							uni.navigateTo({
								url
							});
						} else {
							uni.navigateTo({
								url: '/pages/public/mobile'
							});
						}
					});
				} else {
					this.goLoginInfo();
				}
			},
			//统一登录跳转
			goLoginInfo() {
				this.$queue.setData('href', '/pages/member/user');
				uni.navigateTo({
					url: '/pages/member/register'
				});
			},
			navToLogins(url) {
				this.$queue.setData('href', '/pages/member/user');
				let token = this.$queue.getData('token');
				if (token) {
					uni.navigateTo({
						url
					});
				} else {
					this.goLoginInfo();
				}
			},
			navToYaoqingLogins(url) {
				let token = this.$queue.getData('token');
				let relationId = this.$queue.getData('relation_id');
				if (token) {
					if (relationId) {
						uni.navigateTo({
							url
						});
					} else {
						uni.navigateTo({
							url: '/pages/public/mobile'
						});
					}
				} else {
					this.goLoginInfo();
				}
			},
			goUpdataNickName() {
				let token = this.$queue.getData('token');
				if (token) {
					uni.navigateTo({
						url: './updateNickName'
					});
				} else {
					this.goLoginInfo();
				}
			},
			goLogin() {
				let token = this.$queue.getData('token');
				if (!token) {
					this.goLoginInfo();
				} else {
					let that = this;
					var url = null;
					let userId = this.$queue.getData('userId');
					uni.showActionSheet({
						// itemList按钮的文字接受的是数组
						itemList: ["查看头像", "从相册选择图片"],
						success(e) {
							var index = e.tapIndex
							if (index === 0) {
								// 用户点击了预览当前图片
								// 可以自己实现当前头像链接的读取
								let url = that.image_url;
								let arr = []
								arr.push(url)
								uni.previewImage({
									// 预览功能图片也必须是数组的
									urls: arr
								})
							} else if (index === 1) {
								uni.chooseImage({
									count: 1, //默认9
									sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
									sourceType: ['album'], //从相册选择
									success: function(res) {
										uni.showLoading({
											title: '上传中...'
										});
										let token = uni.getStorageSync('token');
										uni.uploadFile({
											url: that.config("APIHOST1") +
												'/alioss/upload', //仅为示例，非真实的接口地址
											filePath: res.tempFilePaths[0],
											header: {
												token: token
											},
											name: 'file',
											success: uploadFileRes => {
												url = JSON.parse(uploadFileRes.data).data;
												that.$Request.postJson(
													'/user/updateImgUrl?userId=' +
													userId + '&imgUrl=' + url).then(
													res => {
														uni.hideLoading();
														if (res.status === 0) {
															that.$queue.showToast(
																"更新成功");
															that.getUserInfo(userId);
														}
													});
											}
										});
									}
								});
							}
						}
					})
				}
			},
			config: function(name) {
				var info = null;
				if (name) {
					var name2 = name.split("."); //字符分割
					if (name2.length > 1) {
						info = configdata[name2[0]][name2[1]] || null;
					} else {
						info = configdata[name] || null;
					}
					if (info == null) {
						let web_config = cache.get("web_config");
						if (web_config) {
							if (name2.length > 1) {
								info = web_config[name2[0]][name2[1]] || null;
							} else {
								info = web_config[name] || null;
							}
						}
					}
				}
				return info;
			}
		}
	};
</script>
<style lang="scss">
	page {
		background: #F2F6FC;
	}

	button::after {
		border: none;
	}

	.myOrderBackgroundImage {
		position: absolute;
		width: 700rpx;
		height: 360rpx;
		background-size: 100%;
		margin: 30rpx;
	}

	.limapboxqing2 {
		height: 82rpx;
		font-size: 32rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #333333;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
	}

	.jixu_btn {
		background: linear-gradient(90deg, #FD954A 0%, #FE3935 100%);
		border-radius: 50rpx;
		text-align: center;
		width: 400rpx;
		margin-top: 20rpx;
		color: #FFFFFF;
		font-size: 30rpx;
		height: 60rpx;
		line-height: 60rpx;
	}

	.list_item1 {
		padding: 27rpx;
		margin-top: 30rpx;

		image {
			width: 200rpx;
			height: 200rpx;
		}

		.djs_view {
			display: flex;
			font-size: 28rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			width: 100%;
			align-items: center;
		}

		.item_money {
			font-size: 36rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
		}

		.item_mian {
			font-size: 24rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #999999;
			margin-left: 10rpx;
		}

		.item_yao {
			width: fit-content;
			min-width: 124rpx;
			height: 102rpx;
			background: #FFF4F6;
			border: 3rpx solid #FF2638;
			border-radius: 8rpx;
			text-align: center;

			.item_yaonumber {
				margin-top: 6rpx;
				padding: 0rpx 16rpx;
				font-size: 26rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
			}

			.item_yao_view {
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
				width: 100%;
				height: 50rpx;
				text-align: center;
				line-height: 48rpx;
				border-top: 4rpx solid #FF2638;
				margin-top: 10rpx;
				background: linear-gradient(90deg, #FD954A 0%, #FE3935 100%);
				border-radius: 0px 0px 8rpx 8rpx;
			}
		}
	}

	.header {
		background: linear-gradient(90deg, #FCEDE8 0%, #FCE4E8 100%);
		height: 120upx;
		position: relative;
		line-height: 150upx;
		width: 100%;
		text-align: center;
		color: #0A0E10;
		font-size: 32upx;
		position: fixed;
		top: 0upx;
		left: 0;
		right: 0;
		z-index: 99;

		view {
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #0A0E10;
		}
	}

	.app {
		padding: 22rpx;
	}

	.cell {
		margin: 22rpx;
	}

	.tui-order-text,
	.tui-tool-text {
		font-size: 26rpx;
		font-weight: 400;
		color: #666;
		padding-top: 4rpx;
	}

	.tui-tool-text {
		font-size: 24rpx;
	}

	.tui-tool-text1 {
		font-size: 24rpx;
		margin-top: 15upx;
		color: #666666;
	}

	.img-xin {
		width: 46upx;
		height: 55upx;
		position: relative;
		top: 40upx;
		left: -56upx;
	}

	.tui-order-list {
		width: 100%;
		height: fit-content;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.tui-order-item {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.tui-box {
		width: 100%;
		background: #fff;
		// box-shadow: 0 3rpx 20rpx rgba(183, 183, 183, 0.3);
		border-radius: 24upx;
		// overflow: hidden;
	}

	.tui-cell-header {
		width: 100%;
		height: 74rpx;
		padding: 0 26rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.tui-tits {
		color: #999999;
		font-size: 25rpx;
		letter-spacing: 1rpx;
		margin-right: 10rpx;
	}

	.tui-tits image {
		width: 10rpx;
		height: 20rpx;
		margin-left: 10rpx;
	}

	.tui-cell-title {
		font-size: 30rpx;
		line-height: 30rpx;
		font-weight: 600;
		color: #333;
	}

	.tui-tool-box {
		margin-top: 20rpx;
	}

	// 收藏夹
	.addTo {
		display: flex;
		flex-direction: column;
		color: #333333;

		text-align: center;
		font-size: 38upx;
	}

	.user-wen {
		font-size: 24upx;
		margin-left: 10upx;
		margin-top: 10upx;
		color: #999999;
	}

	.tui-flex-wrap {
		flex-wrap: wrap;
		height: fit-content;
		padding-bottom: 30rpx;
	}

	.tui-flex-wrap1 {
		flex-wrap: wrap;
		height: 150upx;
		padding-bottom: 30rpx;
	}

	.tui-tool-item1 {
		width: 20%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		padding-top: 20rpx;
	}

	.tui-tool-item {
		width: 25%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		padding-top: 40rpx;
	}

	.tui-tool-icon {
		width: 70rpx;
		height: 70rpx;
		display: block;
		padding: 4upx;
	}

	.tui-tool-icon1 {
		width: 60rpx;
		height: 60rpx;
		display: block;
	}


	%flex-center {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
	}

	%section {
		display: flex;
		justify-content: space-around;
		align-content: center;
		background: #fff;
		border-radius: 10px;
	}

	.user-info-box {
		width: 100%;
		height: 200upx;
		align-items: center;
		z-index: 1;

		.portrait {
			width: 110upx;
			height: 110upx;
			border-radius: 50%;
			margin-left: 20upx;
		}

		.username {
			font-size: 33rpx;
			color: #333333;
			margin-left: 10px;
			letter-spacing: 1rpx;
		}

		.username1 {
			font-size: 14px;
			color: whitesmoke;
			margin-left: 10px;
		}
	}

	.vip-card-box {
		display: flex;
		// width: 93%;
		// margin: 0 auto;
		position: relative;
		top: -70rpx;
		height: 160rpx;
		overflow: hidden;
		background-image: url('https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/6842b8d552232deff917baaa85a5c19c.png');
		// background: linear-gradient(#161616 0%, #363636 100%);
		background-size: 100% 100%;
		background-repeat: no-repeat;
		border-radius: 15rpx;

		justify-content: space-between;
		// align-items: center;
		padding: 40upx 60upx;

		.card-bg {
			width: 440upx;
			height: 320upx;
		}

		.b-btn {
			width: 160rpx;
			height: 55rpx;
			text-align: center;
			font-size: 25rpx;
			color: #333333;
			border-radius: 32rpx;
			z-index: 1;
			background: #FFFFFF;
			display: flex;
			justify-content: center;
			align-items: center;
			// margin-right: 20rpx;
		}

		.b-btn image {
			width: 30rpx;
			height: 30rpx;
		}

		.tit {
			font-size: 14px;
			color: #fde3de;
			// margin-left: 20upx;
		}
	}

	.vipFont image {
		width: 125upx;
		height: 30upx;
	}

	.yticon {
		font-size: 24rpx;
		color: #C8D0E9;
		// margin-right: 10rpx;
	}

	.myteam {
		width: 95%;
		margin: 0 auto;
		border-radius: 24upx;
		background: #FFFFFF;
		padding: 20upx 30upx;
		position: relative;
	}

	.teammoney {
		// flex: 1;
		width: 320upx;
		height: 160upx;
		padding: 20rpx 15rpx;
		background-image: url('https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/9937147d823c66280d9f4acded8f078c.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
		padding: 30upx 30upx;

	}

	.mymoney {
		// flex: 1;
		// background: #FFFFFF;
		width: 320upx;
		height: 160upx;
		padding: 20rpx 15rpx;
		background-image: url('https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/482469735e20a3543fcf97c9ca2fee10.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
		padding: 30upx 30upx;
	}

	.team_b {
		display: flex;
		align-items: center;
		color: #333333;
		margin-top: 30rpx;
		font-size: 24upx;

	}

	.team {
		width: 100%;
		color: black;
		font-size: 24upx;
		font-weight: 500;
		color: #999999;
	}

	.teammoney text {
		color: #333333;
		font-size: 38upx;
		display: block;
		margin-top: 4rpx;
		font-weight: 600;
	}

	.mymoney text {
		color: #333333;
		font-size: 38upx;
		display: block;
		margin-top: 4rpx;
		font-weight: 600;
	}

	.bgImg {
		background-image: url('https://api.shengqianxiong.com.cn/file/uploadPath/2022/06/20/d8dab53d9a8efb823ba35e17b0851843.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
		height: 170rpx;
		/* #ifdef APP-PLUS */
		margin-top: 60rpx;
		/* #endif */
		/* #ifndef APP-PLUS */
		padding-top: 20rpx;
		/* #endif */
	}
</style>
